package kau.vo;

public class Customer {
	private String custId;
	private String password;
	private String custName;
	private String custSsn;
	private String custEmail;
	private String phoneNumber;
	private String parentPhoneNumber;
	private String passwordQuestion;
	private String passwordAnswer;
	private String joinDate;
	private int custLevel;

	private String[] mailSplit;
	
	public Customer() {
	}

	public Customer(String custId, String password, String custName,
			String custSsn, String custEmail, String phoneNumber,
			String parentPhoneNumber, String passwordQuestion,
			String passwordAnswer, String joinDate, int custLevel) {
		super();
		this.custId = custId;
		this.password = password;
		this.custName = custName;
		this.custSsn = custSsn;
		this.custEmail = custEmail;
		this.phoneNumber = phoneNumber;
		this.parentPhoneNumber = parentPhoneNumber;
		this.passwordQuestion = passwordQuestion;
		this.passwordAnswer = passwordAnswer;
		this.joinDate = joinDate;
		this.custLevel = custLevel;
	}

	
	
	public Customer(String custId, String password, String custEmail,
			String phoneNumber, String parentPhoneNumber,
			String passwordQuestion, String passwordAnswer, int custLevel) {
		super();
		this.custId = custId;
		this.password = password;
		this.custEmail = custEmail;
		this.phoneNumber = phoneNumber;
		this.parentPhoneNumber = parentPhoneNumber;
		this.passwordQuestion = passwordQuestion;
		this.passwordAnswer = passwordAnswer;
		this.custLevel = custLevel;
	}

	public Customer(String custId, String custEmail, String phoneNumber,
			String parentPhoneNumber, String passwordQuestion,
			String passwordAnswer) {
		super();
		this.custId = custId;
		this.custEmail = custEmail;
		this.phoneNumber = phoneNumber;
		this.parentPhoneNumber = parentPhoneNumber;
		this.passwordQuestion = passwordQuestion;
		this.passwordAnswer = passwordAnswer;
	}

	public String getCustId() {
		return custId;
	}

	public void setCustId(String custId) {
		this.custId = custId;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getCustName() {
		return custName;
	}

	public void setCustName(String custName) {
		this.custName = custName;
	}

	public String getCustSsn() {
		return custSsn;
	}
	
	public String getPreCustSsn() {
		return (String) custSsn.subSequence(0, 6);
	}
	public String getPostCustSsn() {
		return custSsn.substring(6);
		
	}
	public void setCustSsn(String custSsn) {
		this.custSsn = custSsn;
	}

	public String getCustEmail() {
		return custEmail;
	}

	public String getCustEmailAccount() {
		mailSplit = custEmail.split("@");
		return mailSplit[0].toString();
	}
	public String getCustEmailDomain() {
		return mailSplit[1].toString();
	}
	public void setCustEmail(String custEmail) {
		this.custEmail = custEmail;
	}

	public String getPhoneNumber() {
		return phoneNumber;
	}
	public String getPhoneNumber1() {
		return (String) phoneNumber.subSequence(0, 3);
	}
	public String getPhoneNumber2() {
		if(phoneNumber.length()==10)
			return (String) phoneNumber.subSequence(3, 6);
		else//11자리
			return (String) phoneNumber.subSequence(3, 7);
	}
	public String getPhoneNumber3() {
		if(phoneNumber.length()==10)
			return phoneNumber.substring(6);
		else
			return phoneNumber.substring(7);
		
	}
	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}

	public String getParentPhoneNumber() {
		return parentPhoneNumber;
	}
	
	public String getParentPhoneNumber1() {
		return (String) parentPhoneNumber.subSequence(0, 3);
	}
	public String getParentPhoneNumber2() {
		if(parentPhoneNumber.length()==10)
			return (String) parentPhoneNumber.subSequence(3, 6);
		else//11자리
			return (String) parentPhoneNumber.subSequence(3, 7);
	}
	public String getParentPhoneNumber3() {
		if(parentPhoneNumber.length()==10)
			return parentPhoneNumber.substring(6);
		else
			return parentPhoneNumber.substring(7);
		
	}
	

	public void setParentPhoneNumber(String parentPhoneNumber) {
		this.parentPhoneNumber = parentPhoneNumber;
	}

	public String getPasswordQuestion() {
		return passwordQuestion;
	}

	public void setPasswordQuestion(String passwordQuestion) {
		this.passwordQuestion = passwordQuestion;
	}

	public String getPasswordAnswer() {
		return passwordAnswer;
	}

	public void setPasswordAnswer(String passwordAnswer) {
		this.passwordAnswer = passwordAnswer;
	}

	public String getJoinDate() {
		return joinDate;
	}

	public void setJoinDate(String joinDate) {
		this.joinDate = joinDate;
	}

	public int getCustLevel() {
		return custLevel;
	}

	public void setCustLevel(int custLevel) {
		this.custLevel = custLevel;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((custId == null) ? 0 : custId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Customer other = (Customer) obj;
		if (custId == null) {
			if (other.custId != null)
				return false;
		} else if (!custId.equals(other.custId))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Customer [custId=" + custId + ", password=" + password
				+ ", custName=" + custName + ", custSsn=" + custSsn
				+ ", custEmail=" + custEmail + ", phoneNumber=" + phoneNumber
				+ ", parentPhoneNumber=" + parentPhoneNumber
				+ ", passwordQuestion=" + passwordQuestion
				+ ", passwordAnswer=" + passwordAnswer + ", joinDate="
				+ joinDate + ", custLevel=" + custLevel + "]";
	}

}